package com.zbkj.crmeb.merchant.admin.service;

import java.util.List;
import java.util.Set;

import com.baomidou.mybatisplus.extension.service.IService;
import com.common.PageParamRequest;
import com.github.pagehelper.PageInfo;
import com.zbkj.crmeb.export.vo.ProductExcelVo;
import com.zbkj.crmeb.front.request.IndexStoreProductSearchRequest;
import com.zbkj.crmeb.store.model.*;
import com.zbkj.crmeb.store.request.ChannelGroupBookingRequest;
import com.zbkj.crmeb.store.request.StoreProductRequest;
import com.zbkj.crmeb.store.request.StoreProductSearchRequest;
import com.zbkj.crmeb.store.response.StoreProductAttrValueResponse;
import com.zbkj.crmeb.store.response.StoreProductNormResponse;
import com.zbkj.crmeb.store.response.StoreProductResponse;
import com.zbkj.crmeb.store.response.StoreProductTabsHeader;

/**
* @author Mr.Zhang
* @description StoreProductService 接口
* @date 2020-05-27
*/
public interface StoreProductStockService {


    /**
     * 对于拼团活动更新库存量
     * @return
     */
    boolean updateStock(Integer productId, String attrValueId, Integer num, Integer type, Integer activityGroupId);

    /**
     * 后台显示库存量(总后台，商户后台，供应商后台)
     * @return
     */
    boolean showStock(StoreProductAttrValue attrValue);

    /**
     * 后台显示库存量(总后台，商户后台，供应商后台)
     * @return
     */
    boolean showStockBatch(List<StoreProductAttrValue> attrValues);

    /**
     * 供应商修改库存量
     * @return
     */
    boolean editStock(StoreProductAttrValue newAttrValue, StoreProductAttrValue oldAttrValue);

    /**
     * 没有修改商品，则校验新的库存量是否超过商品剩余可用库存量
     * @param request
     */
    void checkNewStock(ChannelGroupBookingRequest request, List<Integer> activityIds);

    /**
     * 校验商品的拼团库存量是否超过商品库存量
     * @param request
     */
    void checkStock(ChannelGroupBookingRequest request);

    /**
     * 修改商品时，归还原商品锁定的库存
     * @param request
     * @param activityIds
     */
    void returnStock(Integer productId, ChannelGroupBookingRequest request, List<Integer> activityIds);

    /**
     * 退款时，归还商品锁定的库存
     */
    boolean refundStock(StoreOrderInfo storeOrderInfo);

    /**
     * 归还拼团锁定的库存量
     */
    void returnStockForActivityFinish(ChannelGroupBooking groupBooking, List<Integer> activityIds, String logID);

    /**
     * 设置拼团价和拼团库存
     * @param groupId
     * @param storeProductAttrValues
     */
    void calcStockAndPrice(String groupId, Integer activityId, List<StoreProductAttrValue> storeProductAttrValues);

    String getGroupIdByProductIdAndLeaderIdV2(String leaderId, Integer productId, Integer merId);

    String getGroupIdByProductIdAndLeaderId(String leaderId, List<Integer> stringToArrayInt, Integer merId, boolean isNew);
}
